package algorithmTopics.designPatterns.prototypePattern;

/**
 * 原型模式
 * 用于有一个原型，快速生成一个复制的原型对象
 *
 * 操作：实现cloneable 接口, 重写clone 方法
 *
 * @author 86155
 * @date 2025/07/22
 */
public class Demo {
    public static void main(String[] args) throws CloneNotSupportedException {
        ShapeCache.loadCache();
        Shape shape = ShapeCache.getShape("1");
        Shape temp = shape;
        System.out.println(shape.getType() + "Shape");
        System.out.println(shape == ShapeCache.shapeMap.get("1"));
        System.out.println(shape == temp);
    }
}
